]> dgit.raspbian.org Git - gnome-shell.git/commit
st/theme-node-drawing: Trace the correct path for inset box shadows
authorDaniel van Vugt <daniel.van.vugt@canonical.com>
Thu, 26 Sep 2024 10:26:21 +0000 (18:26 +0800)
committerDaniel van Vugt <daniel.van.vugt@canonical.com>
Thu, 26 Sep 2024 11:59:22 +0000 (19:59 +0800)
commitdde13b30c79776accf1b54fcd131441f44fc8f95
tree1ad7b219655b3eb1a6eb325f5c2755f7cbede2c3
parent934dbe549567f87d7d6deb6f28beaceda7da1d46
st/theme-node-drawing: Trace the correct path for inset box shadows

Previously we just copied the outer path and scaled it down, but that
resulted in an inconsistent thickness at the corners because the pivot
points for the arcs also moved inward.

So now we trace the inset path explicitly to maintain the correct
thickness (spread) around all the corners.

The spec actually mentions you need to do it in section 6.1 [1]:

> Note that for inner shadows, expanding the shadow (creating more
> shadow area) means contracting the shadow’s perimeter shape.

Despite the fact the example diagram gets it wrong in section 6.1.1 [2],
it does then follow with more confirmation that the shadow radius should
be reduced:

> To preserve the box’s shape when spread is applied, the corner radii
> of the shadow are also increased (decreased, for inner shadows) from
> the border-box (padding-box) radii by adding (subtracting) the spread
> distance (and flooring at zero).

[1] https://www.w3.org/TR/css-backgrounds-3/#box-shadow
[2] https://www.w3.org/TR/css-backgrounds-3/#shadow-shape

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7913
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3488>
src/st/st-theme-node-drawing.c